#ifndef NDEBUG
#define ASSERT(cond) if(!(cond))\
                        printf("FAIL: %s in %s, %d ;", \
                        #cond, __FILE__, __LINE__);
#else #define ASSERT(cond) ;
#endif
#define NULLPTR(p) if(!p) printf("GOT NULL POINTER");abort();
#define POISON (-123123)

//1 stack adress variable is damaged
//2 problems with len (<0, >max)
//3 impossible to broaden
//4 stack is full
//5 stack wasn't poisoned
enum errors{STKERR_ADRESS = 1, STKERR_LEN, STKERR_BROADEN, STKERR_FULL, STKERR_NOTPOISONED};
struct stack_t
{
    int  len;
    int  maxSize;
    double* stack;
};

//int for errors
int  stack_ctor   (struct stack_t* stk);
void stack_dtor   (struct stack_t* stk);
int  stack_broaden(struct stack_t* stk);
int  stack_push   (struct stack_t* stk, double value);
double  stack_pop    (struct stack_t* stk, int* err);
int  stack_OK     (struct stack_t* stk);
void stack_bump   (struct stack_t* stk);
int  stack_empty  (struct stack_t* stk);
void stack_error  (struct stack_t* stk, int err);

int  smartFileReader(struct stack_t* stk);
